package com.ymatou.startApp;

import java.io.IOException;

import android.os.RemoteException;

import com.android.uiautomator.core.UiObjectNotFoundException;
import com.android.uiautomator.testrunner.UiAutomatorTestCase;
import com.ymatou.run.RunTestCase;
import com.ymatou.run.UiDeviceUtil;
import com.ymatou.search.SearchMainPageTest;
import com.ymatou.util.Logger;

@SuppressWarnings("deprecation")
public class HelloUiAutomator extends UiAutomatorTestCase{

    private static final String TAG = HelloUiAutomator.class.getSimpleName();
    private UiDeviceUtil uiDevice = new UiDeviceUtil();

    protected void setUp() throws Exception {
    	Logger.log(TAG, "setUp of " + getName());
    	uiDevice.wakeUp();
        super.setUp();
    }
    
	public void testOpenYMTApp() throws IOException, UiObjectNotFoundException, RemoteException, InterruptedException {
        Runtime.getRuntime().exec("monkey -p com.ymatou.shop -v 1");
        Logger.log(TAG, "testOpenYMTApp of " + getName());
        
        //CheckGuideTest.checkGuide();
        //NewUserCouponDialogTest.newUserCouponDialog(true);
        new SearchMainPageTest().testSearchMainPage();   
    }

    protected void tearDown() throws Exception {
        Logger.log(TAG, "tearDown of " + getName());
        super.tearDown();
    }
    
    public static void main(String[] args) {
    	RunTestCase runTestCase = new RunTestCase("testOpenYMTApp", 
    			"com.ymatou.startApp.HelloUiAutomator", "", "2");
    	runTestCase.setDebug(false);
    	runTestCase.runUiautomator();
    }
}
